home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / arraylen.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  960 b   |  36 lines

  1. <!--- This example shows ArrayLen --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>ArrayLen Example</TITLE>
  5. </HEAD>
  6.  
  7. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  8. <BODY  bgcolor="#FFFFD5">
  9.  
  10. <H3>ArrayLen Example</H3>
  11.  
  12. <CFQUERY NAME="GetEmployeeNames" DATASOURCE="cfsnippets">
  13. SELECT FirstName, LastName FROM Employees
  14. </CFQUERY>
  15. <!--- create an array --->
  16. <CFSET myArray = ArrayNew(1)>
  17. <!--- set element one to show where we are --->
  18. <CFSET myArray[1] = "Test Value">
  19. <!--- loop through the query and append these names
  20. successively to the last element --->
  21. <CFLOOP query="GetEmployeeNames">
  22.     <CFSET temp= #ArrayAppend(myArray, "#FirstName# #LastName#")#>
  23. </CFLOOP>
  24. <!--- show the resulting array as a list --->
  25. <CFSET myList=ArrayToList(myArray, ",")>
  26. <!--- output the array as a list --->
  27. <CFOUTPUT>
  28.     <P>The contents of the array are as follows:
  29.     <P>#myList#
  30.     <P>This array has #ArrayLen(MyArray)# elements.
  31. </CFOUTPUT>
  32.  
  33. </BODY>
  34. </HTML>       
  35.       
  36.